<template>
    <div>
        {{ localInfoList }}
        {{
            value
        }}
        <!-- <t-multilingual
        :visible="true"
        label="测试标题"
        :helpConf="true"
        helpTooltip="我是提示"
        helpPlacement="right"
        labelPosition="left"
        helpMore="link"
        helpMoreLink="static"
        helpMoreLinkHrefStatic="https://www.baidu.com"
        helpMoreLinkHrefExp="https://www.qq.com"
        v-model:value="value"
        placeholder="提示语1235"
        :showHint="true"
        hintMode="custom"
        hintMsg="自定义文字"
        requiredMessage="必填提示"
        :localInfoList="localInfoList"
        :required='true'
        space="14"

    /> -->

    </div>
      <t-multilingual
    label='多语言组件'
    :tabIndex='0'
    :visible='true'
     space="14"
     :rules="[e=>!!e||'111111111']"
             ref="ref_mutilingual"
    dataField='Name'
    maxLengthMsg="提示11111111111"
    :maxLength='3'
    requiredMultRule='Full'
    :required='true'
  >
  </t-multilingual>

<div @click="validate">Valite</div>
</template>

<script setup>
import { onMounted, ref, watch } from 'vue';

const value = ref({
        'Nam_zh_CN': '中文',
        '_en_US': '英文',
        '_jp': '日文',
        '_fr': '法文',
        '_zh_TW': '繁体'
});
const ref_mutilingual = ref(null);
const localInfoList = ref(null)
try {
    localInfoList.value =   TFF.common.ctx.getLocaleInfo()
} catch (error) {

}

if(!localInfoList.value) {
    localInfoList.value =  [
        {
          ID: 'zh-CN',
          ShortName: '简',
          DisplayName: '中文 (简体)',
          RepositoryCode: 'zh_CN',
          Direction: null,
          IsMain: true
        }
      ]
}
localInfoList.value = localInfoList.value.map((item) => {
    return { lang: item.ID, langSuffix: `_${item.ID.replace("-", "_")}`, ...item }
})
console.log('localInfoList', localInfoList.value);
// watch(()=>value.value, (newVal, oldVal)=>{
//     console.log('newVal', newVal);
//     console.log('oldVal', oldVal);
// }, { deep: true })
onMounted(() => {
    console.log('localInfoList', localInfoList.value);
    console.log('ref_mutilingual', ref_mutilingual);
    //设置默认值
    // ref_mutilingual.value.setValue( '_en_US','英文')
    ref_mutilingual.value.setValue({
        // 'Name': '中文',
        // 'Name_en_US': '英文',
        // 'Name_jp': '日文',
        // 'Name_fr': '法文',
        // 'Name_zh_TW': '繁体'
    })
})
const validate = () => {
    ref_mutilingual.value.validate()
}
</script>
